/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.meducated.sim.model;

/**
 *
 * @author Carina
 */
public final class Timing {
    /**
     * 
     */
    public static final double UNDEFINED = Double.NaN;
    public static final double MIN_INTERVAL = 0.001;
    public static final double MIN_RATE = 1000;
    
    /**
     * 
     * @param d
     * @return 
     */
    public static double intervalToRate(double d) {
        if(d < MIN_INTERVAL) {
            return MIN_RATE;
        }
        else {
            return 1/d;
        }
    }
    
    /**
     * 
     * @param d
     * @return 
     */
    public static double rateToInterval(double d) {
        if(d < MIN_RATE) {
            return MIN_INTERVAL;
        }
        else {
            return 1/d;
        }
    }
    
    /**
     * 
     * @param d
     * @return 
     */
    public static double seconds(double d) {
        return d;
    }
    
    /**
     * 
     * @param d
     * @return 
     */
    public static double minutes(double d) {
        return d * 60;
    }
    
    /**
     * 
     * @param d
     * @return 
     */
    public static double hours(double d) {
        return 60 * 60 * d;
    }
    
    /**
     * 
     * @param d
     * @return 
     */
    public static double days(double d) {
        return 24 * 60 * 60 * d;
    }
    
}
